
layui.use(['form', 'layer', 'table', 'laytpl'], function () {
    //声明变量
    var layer = parent.layer === undefined ? layui.layer : top.layer
            , table = layui.table
            , form = layui.form
            , layedit = layui.layedit
            , laytpl = layui.laytpl
            , $ = layui.$;


    //监听提交
    form.on('submit(submitForm)', function (data) {
        var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.2});
        $.post(aUrl, data.field, function (data) {
            if (data.success) {
                layer.close(index);
                layer.msg("保存成功！");
                layer.closeAll("iframe");
                //刷新父页面
                parent.location.reload();
                return false;
            } else {
                layer.close(index);
                layer.msg(data.msg);
            }
        }, 'json');
        return false;
    });

});